package it.polito.connectedcar.network;

public enum EntityType {

	TRAFFIC_LIGHT(0),
	INDUCTIVE_LOOP(1),
	VEHICLE(2),
	NEIGHBORHOOD(3);
	
	private final int typeCode;
	private EntityType(int typeCode) {
		this.typeCode = typeCode;
	}
	
	public int getTypeCode()
	{
		return this.typeCode;
	}
	
	public static EntityType fromEntityCode(int typeCode)
	{
		for(EntityType type:EntityType.values())
		{
			if(type.getTypeCode()==typeCode)
				return type;
		}
		throw new IllegalArgumentException("no EntityTyoe exists for the specified typeCode");
	}
}
